package com;


import com.edu.modules.comm.Utils;
import com.sari.common.utils.DateUtils;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;


public class MainTest {


    public static void main(String[] args)  {

//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        Date currentDate = new Date();
//        // 比如今天是2012-12-25
//        List<Date> days = dateToWeek(currentDate);
//        System.out.println("今天的日期: " + sdf.format(currentDate));
//        for (Date date : days) {
//            System.out.println(sdf.format(date));
//        }
          System.out.println("星期==="+DateUtils.getMonthByDate("2012-06-25"));
    }

//    public static List getDayListOfMonth(int month) {
//        List list = new ArrayList();
//        Calendar aCalendar = Calendar.getInstance(Locale.CHINA);
//        String year = DateUtils.getYear();
//        aCalendar.set(Integer.valueOf(year), month-1, 1);
//        int day = aCalendar.getActualMaximum(aCalendar.DATE);
//        for (int i = 1; i <= day; i++) {
//            String aDate = year+"-"+(month<10?"0"+month:month)+"-"+(i<10?"0"+i:i);
//            list.add(aDate);
//        }
//        return list;
//    }

    public static List<Date> dateToWeek(Date mdate) {

        int b = mdate.getDay();

        Date fdate;

        List<Date> list = new ArrayList<Date>();

        Long fTime = mdate.getTime() - b * 24 * 3600000;

        for (int a = 1; a <= 7; a++) {

            fdate = new Date();

            fdate.setTime(fTime + (a * 24 * 3600000));

            list.add(a-1, fdate);

        }

        return list;

    }
}